home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
utils
/
gemfut15.lzh
/
AESUTRC5.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-08-27
|
2KB
|
84 lines
/**************************************************************************
*
* AESFAST PD utilties.
*
* Rectangle utilities 5...
* rc_gadjust (formerly objclg_adjust)
* rc_vadjust (formerly objclv_adjust)
*
* 02/28/89 v1.3
* Added code to prevent any returned structure element from
* being negative, since negative screen indicies do bad things
* on a blit, and tend to leave sleeping crashes lurking in the
* system if used as the clipping rectangle for objc_draw.
*************************************************************************/
#include <gemfast.h>
/*-------------------------------------------------------------------------
* rc_gadjust - Adjust a GRECT-type rectangle in the x and/or y coordinate.
*-----------------------------------------------------------------------*/
void
rc_gadjust(prect, xadjust, yadjust)
register GRECT *prect;
int xadjust;
int yadjust;
{
prect->g_x -= xadjust;
prect->g_y -= yadjust;
prect->g_w += xadjust * 2;
prect->g_h += yadjust * 2;
if (prect->g_x < 0) {
prect->g_x = 0;
}
if (prect->g_y < 0) {
prect->g_y = 0;
}
if (prect->g_w < 0) {
prect->g_w = 0;
}
if (prect->g_h < 0) {
prect->g_h = 0;
}
}
/*-------------------------------------------------------------------------
* rc_vadjust - Adjust a VRECT-type rectangle in the x and/or y coordinate.
*-----------------------------------------------------------------------*/
void
rc_vadjust(prect, xadjust, yadjust)
register VRECT *prect;
int xadjust;
int yadjust;
{
prect->v_x1 -= xadjust;
prect->v_y1 -= yadjust;
prect->v_x2 += xadjust;
prect->v_y2 += yadjust;
if (prect->v_x1 < 0) {
prect->v_x1 = 0;
}
if (prect->v_y1 < 0) {
prect->v_y1 = 0;
}
if (prect->v_x2 < 0) {
prect->v_x2 = 0;
}
if (prect->v_y2 < 0) {
prect->v_y2 = 0;
}
}